import {_decorator, Component, Node, RigidBody, Vec3, v3} from 'cc';

const {ccclass, property} = _decorator;

@ccclass('BodyController')
export class BodyController extends Component {
    /**
     * 刚体
     */
    private rigidBody: RigidBody;

    start() {
        // 初始化
        this.init();
        // 设置监听
    }

    /**
     * 初始化
     */
    private init() {
        // 初始化刚体
        this.rigidBody = this.getComponent(RigidBody);
    }

    /**
     * 跳
     */
    public jump() {
        // 给一个向上的力
        this.rigidBody.applyForce(v3(0, 1, 0));
    }

    update(deltaTime: number) {

    }
}

